<%@ page import="org.hr.xtime.absence.Day"%>
<g:if test="${day instanceof Date}">
	<%
		String fromDate = day.format('dd-MM-yyyy') 
		String toDate = fromDate 
	%>
	<g:if test="${day.toCalendar().get(Calendar.DAY_OF_WEEK) in [Calendar.SATURDAY,Calendar.SUNDAY] }">
		<td class="calCell weekend">
			<g:link controller="request" action="create" params="[fromDate:fromDate, toDate:toDate]" target="NEW"></g:link>
		</td>
	</g:if>
	<g:else>
		<td class="calCell">
			<g:link controller="request" action="create" params="[fromDate:fromDate, toDate:toDate]" target="NEW"></g:link>
		</td>
	</g:else>
</g:if>
<g:else>
<g:if test="${day!=null}">
	<g:if test="${day instanceof Day }">
		<%
			def style = "dayNew"
			if (day.status == "new") style = "dayNew"
			if (day.status in ["approved","final"]) style = "dayApproved"
			if (day.status == "disapproved") style = "dayDisapproved"
			if (day.status == "canceled") style = "dayCanceled"
		%>
		<td class="calCell <%=style%>">
			<g:link controller="request" action="show" params="[id:day.id]" target="NEW">
				${day.type.label.substring(0, 1)}
			</g:link>
		</td>
	</g:if>
</g:if>
</g:else>